package com.isoft.result;

import lombok.Data;

@Data
public class R {
    private String msg;
    private Integer code;
    private Object data;

    public R() {
    }
    public R(String msg, Integer code, Object data) {
        this.msg = msg;
        this.code = code;
        this.data = data;
    }
    public R(String msg, Integer code) {
        this.msg = msg;
        this.code = code;
    }
    public R(String msg) {
        this.msg = msg;
    }
    public R(Integer code) {
        this.code = code;
    }
    public R(Object data) {
        this.data = data;
    }
    public R(String msg, Object data) {
        this.msg = msg;
        this.data = data;
    }
    public R(Integer code, Object data) {
        this.code = code;
        this.data = data;
    }

    public static R ok(){
        return new R("ok",20000);
    }
    public static R ok(Object data){
        return new R(null,20000,data);
    }
    public static R error(){
        return new R("error",500);
    }
    public static R error(Object data){
        return new R("error",500,data);
    }
    public static R error(String msg){
        return new R(msg,500);
    }
    public static R error(String msg,Object data){
        return new R(msg,500,data);
    }
    public static R error(Integer code,String msg){
        return new R(msg,code);
    }
    public static R error(Integer code,String msg,Object data){
        return new R(msg,code,data);
    }
    public static R error(String msg,Integer code){
        return new R(msg,code);
    }
    public static R error(Integer code,Object data){
        return new R("error",code,data);
    }
    public static R error(String msg,Integer code,Object data){
        return new R(msg,code,data);
    }

}
